<?php 
if( $this->ps_id ) {
	echo $this->inlineScript()->setScript('
		var productsId = ' . $this->ps_id. ';
	'); 
}
?>
<?php 
$this->headScript()->appendFile($this->baseUrl().'/public/js/ckeditor.js' ); 
echo $this->inlineScript()->setScript(' 
$(document).ready(function(){
	CKEDITOR.replaceAll( "textarea", {
			toolbar : [ [ "Source", "-", "Bold", "Italic", "Underline", "Strike","TextColor","-","Link","Image","Flash","Table","HorizontalRule","Smiley","SpecialChar","PageBreak" ] ],
			width: 600
		}
	); 

});
');
?>

<table>
	<tr>
		<td>
			<a class="button" href="<?php echo $this->baseUrl() ?>/cpproducts/listspecial">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/left_16.png);" class="inb">Wróć do listy</div>
			</a>
		</td>
		<td>
			<a class="button" href="javascript:void(null)" onclick="$('#formitem').submit()">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/save_16.png);" class="inb">Zapisz</div>
			</a>
		</td>
	</tr>
</table>

<form id="formitem" action="<?php echo $this->baseUrl() ?>/cpproducts/itemspecial<?php echo isSet( $this->ps_id ) ? '/id/' . $this->ps_id : '' ?>" method="post">
<table cellspacing="0" cellpadding="6" class="tform">
	<tr>
		<td class="lb">Nazwa PL:</td>
		<td class="inpy">
			<?php if( isSet( $this->err_name_pl ) ) { ?>
				<input style="border:1px solid red;" type="text" name="name_pl" value="" />
				<div class="formerror"><?php echo $this->err_name_pl ?></div>
			<?php } else { ?>
				<input type="text" name="name_pl" value="<?php echo $this->name_pl ?>" />
			<?php } ?>
		</td>
	</tr>
	<tr>
		<td class="lb">Nazwa EN:</td>
		<td class="inpy"><input type="text" name="name_en" value="<?php echo $this->name_en ?>" /></td>
	</tr>
	<tr>
		<td class="lb">Nazwa CS:</td>
		<td class="inpy"><input type="text" name="name_cs" value="<?php echo $this->name_cs ?>" /></td>
	</tr>

	<tr>
		<td class="lb">Opis PL:</td>
		<td colspan="2" class="inpy"><textarea class="textarea" name="description_pl"><?php echo $this->description_pl ?></textarea></td>
	</tr>
	<tr>
		<td class="lb">Opis EN:</td>
		<td colspan="2" class="inpy"><textarea class="textarea" name="description_en"><?php echo $this->description_en ?></textarea></td>
	</tr>
	<tr>
		<td class="lb">Opis CS:</td>
		<td colspan="2" class="inpy"><textarea class="textarea" name="description_cs"><?php echo $this->description_cs ?></textarea></td>
	</tr>
	<tr>
		<td class="lb">Zastosowanie PL:</td>
		<td colspan="2" class="inpy"><textarea class="textarea" name="application_pl"><?php echo $this->application_pl ?></textarea></td>
	</tr>
	<tr>
		<td class="lb">Zastosowanie EN:</td>
		<td colspan="2" class="inpy"><textarea class="textarea" name="application_en"><?php echo $this->application_en ?></textarea></td>
	</tr>
	<tr>
		<td class="lb">Zastosowanie CS:</td>
		<td colspan="2" class="inpy"><textarea class="textarea" id="application_cs" name="application_cs"><?php echo $this->application_cs ?></textarea></td>
	</tr>
	<tr>
		<td class="lb">Recenzja PL:</td>
		<td colspan="2" class="inpy"><textarea class="textarea" name="test_pl"><?php echo $this->test_pl ?></textarea></td>
	</tr>
	<tr>
		<td class="lb">Recenzja EN:</td>
		<td colspan="2" class="inpy"><textarea class="textarea" name="test_en"><?php echo $this->test_en ?></textarea></td>
	</tr>
	<tr>
		<td class="lb">Recenzja CS:</td>
		<td colspan="2" class="inpy"><textarea class="textarea" name="test_cs"><?php echo $this->test_cs ?></textarea></td>
	</tr>
	<tr>
		<td class="lb">Specyfikacja PL:</td>
		<td colspan="2" class="inpy"><textarea class="textarea" name="specification_pl"><?php echo $this->specification_pl ?></textarea></td>
	</tr>
	<tr>
		<td class="lb">Specyfikacja EN:</td>
		<td colspan="2" class="inpy"><textarea class="textarea" name="specification_en"><?php echo $this->specification_en ?></textarea></td>
	</tr>
	<tr>
		<td class="lb">Specyfikacja CS:</td>
		<td colspan="2" class="inpy"><textarea class="textarea" name="specification_cs"><?php echo $this->specification_cs ?></textarea></td>
	</tr>
	<tr>
		<td class="lb">Widoczny dla rangi 1:</td>
		<td class="inpy">
			<label><input <?php echo ( $this->r1 == 'yes' ) ? 'checked="checked"' : ''; ?> type="radio" name="r1" value="yes" /> Tak</label> <label><input <?php echo ( $this->r1 == 'no' ) ? 'checked="checked"' : ''; ?> type="radio" name="r1" value="no" /> Nie</label>
		</td>
	</tr>
	<tr>
		<td class="lb">Widoczny dla rangi 2:</td>
		<td class="inpy">
			<label><input <?php echo ( $this->r2 == 'yes' ) ? 'checked="checked"' : ''; ?> type="radio" name="r2" value="yes" /> Tak</label> <label><input <?php echo ( $this->r2 == 'no' ) ? 'checked="checked"' : ''; ?> type="radio" name="r2" value="no" /> Nie</label>
		</td>
	</tr>
	<tr>
		<td class="lb">Widoczny dla rangi 3:</td>
		<td class="inpy">
			<label><input <?php echo ( $this->r3 == 'yes' ) ? 'checked="checked"' : ''; ?> type="radio" name="r3" value="yes" /> Tak</label> <label><input <?php echo ( $this->r3 == 'no' ) ? 'checked="checked"' : ''; ?> type="radio" name="r3" value="no" /> Nie</label>
		</td>
	</tr>
	<tr>
		<td class="lb">Widoczny dla rangi 4:</td>
		<td class="inpy">
			<label><input <?php echo ( $this->r4 == 'yes' ) ? 'checked="checked"' : ''; ?> type="radio" name="r4" value="yes" /> Tak</label> <label><input <?php echo ( $this->r4 == 'no' ) ? 'checked="checked"' : ''; ?> type="radio" name="r4" value="no" /> Nie</label>
		</td>
	</tr>
	<tr>
		<td class="lb">Widoczny dla rangi VIP:</td>
		<td class="inpy">
			<label><input <?php echo ( $this->r5 == 'yes' ) ? 'checked="checked"' : ''; ?> type="radio" name="r5" value="yes" /> Tak</label> <label><input <?php echo ( $this->r5 == 'no' ) ? 'checked="checked"' : ''; ?> type="radio" name="r5" value="no" /> Nie</label>
		</td>
	</tr>
	<tr>
			<td class="lb">Cena dla rangi 1:</td>
			<td class="inpy">
				<input type="text" name="price1" value="<?php echo $this->price1 ?>" />
			</td>
		</tr>
		<tr>
			<td class="lb">Cena dla rangi 2:</td>
			<td class="inpy">
				<input type="text" name="price2" value="<?php echo $this->price2 ?>" />
			</td>
		</tr>
		<tr>
			<td class="lb">Cena dla rangi 3:</td>
			<td class="inpy">
				<input type="text" name="price3" value="<?php echo $this->price3 ?>" />
			</td>
		</tr>
		<tr>
			<td class="lb">Cena dla rangi 4:</td>
			<td class="inpy">
				<input type="text" name="price4" value="<?php echo $this->price4 ?>" />
			</td>
		</tr>
		<tr>
			<td class="lb">Cena dla rangi VIP:</td>
			<td class="inpy">
				<input type="text" name="price5" value="<?php echo $this->price5 ?>" />
			</td>
		</tr>
	<tr>
		<td class="lb">Plik graficzny:</td>
		<td class="inpy">
			<?php  
				$this->fileTypes = '"*.jpg"';
				$this->fileTypesDescription = 'Tylko zdjęcia';
				$this->uploadSuccess = 'uploadSuccessImg';
				echo $this->render('global/uploader.phtml'); 
			?>
			<div id="imgcont">
			<?php if( $this->img ) { ?>
				<div id="btnbtn" class="img" style="width:170px;padding:0px;">
					<a onclick="if( confirmDelete() ){ $( '#imgcont' ).empty();  $( '#img' ).attr({ value : '' })  }" style="opacity:0;margin:0px;text-align:center;background:red;width: 170px;" class="delete" href="javascript:void(null)">Usuń</a>
					<img src="<?php echo $this->File( $this->img, 170 ) ?>" />
				</div>
			<?php 
			
				echo $this->inlineScript()->setScript('
					$( "#btnbtn" ).hover(function(){
						$(this).find( "a" ).css({ opacity: 0, display : "block", cursor : "pointer" }).animate({
							opacity : 0.9
						});
					}, function(){
						$(this).find( "a" ).animate({
							opacity : 0
						});
					});
				');
			
			} ?>
			</div>
			<input id="img" type="hidden" name="img" value="<?php echo $this->img ?>" />
			<div>
				<div class="fieldset flash" id="fsUploadProgress1">
					<span class="legend"></span>
				</div>
				<div style="padding-left: 5px;">
					<span id="spanButtonPlaceholder1"></span>
					<input id="btnCancel1" type="button" value="Anuluj" onclick="cancelQueue(upload1);" disabled="disabled" style="margin-left: 2px; height: 22px; font-size: 8pt;width:120px;" />
					<br />
				</div>
			</div>
		
		</td>
	</tr>
	<tr>
		<td class="lb">Plik do pobrania:</td>
		<td class="inpy">
			<?php  
				//$this->fileTypes = '"*.jpg;*.gif;*.png;*.txt;*.doc;*.pdf;*.mp4;*.flv;*.doc;*.xml;*.odt;*.docx"';

$this->fileTypes = '"*.7z;*.ace;*.arj;*.bzip2;*.daa;*.cab;*.dmg;*.gzip;*.jar;*.lbr;*.lqr;*.lha;*.bin;*.rar;*.iso;*.nrg;*.mdx;*.cad;*.dwg;*.drw;*.dxf;*.accdb;*.odb;*.dtp;*.indd;*.mcf;*.pmd;*.pub;*.fm;*.abw;*.acl;*.afp;*.ans;*.asc;*.csv;*.cwk;*.doc;*.docx;*.dot;*.dotx;*.egt;*.mcw;*.odm;*.odt;*.ott;*.pages;*.pap;*.pdax;*.pdf;*.rtf;*.sdw;*.stw;*.sxw;*..tex;*.txt;*.uof;*.wpd;*.wps;*.wpt;*.wrd;*.wrf;*.wri;*.bmp;*.exif;*.gif;*.icns;*.ico;*.jng;*.jpeg;*.jpg;*.jp2;*.mng;*.pdn;*.pgm;*.pict;*.pct;*.png;*.psp;*.px;*.raw;*.tga;*.tiff;*.xcf;*.awg;*.ai;*.eps;*.cgm;*.cdr;*.cmx;*.dxf;*.svg;*.3dmf;*.3ds;*.ac;*.blend;*.max;*.ma;*.pdf;*.pcl;*.ps;*.snp;*.odp;*.otp;*.pot;*.pps;*.ppt;*.pptx;*.sdd;*.shw;*.sti;*.sxi;*.wma;*.wav;*.mp2;*.mp3;*.mp4;*.m4a;*.raw;*.ra;*.ods;*.ots;*.aag;*.3gp;*.asf;*.avi;*.m1v;*.m2v;*.mpeg;*.mpg;*.mov;*.wmv;*.flv;*.html;*.xhtml;*.sen;*.sit;*.sitx;*.tar;*.tgz;*.gz;*.z;*.zip;*.xml;*.png"';

				
				$this->fileTypesDescription = 'Dokumenty';
				$this->uploadSuccess = 'uploadSuccessFile';
				$this->placeholder = 'spanButtonPlaceholder2';
				$this->progres = 'fsUploadProgress2';
				$this->cancel = 'btnCancel2';
				echo $this->render('global/uploader.phtml'); 
			?>
			<div id="attcont">
			<?php if( $this->img ) { ?>
				<div class="img2cl" style="width:260px;padding:0px;">
					<a onclick="if( confirmDelete() ){ $( '#attcont' ).empty();  $( '#attachment' ).attr({ value : '' })  }" style="padding:0px;opacity:0;margin:0px;text-align:center;background:red;width:100%;" class="delete" href="javascript:void(null)">Usuń</a>
					<div style="width:100%;backgrund:#fafafa;"><div style="padding: 6px;"><?php echo $this->attachment ?></div></div>
				</div>
			<?php 
				echo $this->inlineScript()->setScript('
					$( "div.img2cl" ).hover(function(){
						$(this).find( "a" ).css({ opacity: 0, display : "block", cursor : "pointer" }).animate({
							opacity : 0.9
						});
					}, function(){
						$(this).find( "a" ).animate({
							opacity : 0
						});
					});
				');
			}
			?>
			</div>
			<input id="attachment" type="hidden" name="attachment" value="<?php echo $this->attachment ?>" />
			<div>
				<div class="fieldset flash" id="fsUploadProgress2">
					<span class="legend"></span>
				</div>
				<div style="padding-left: 5px;">
					<span id="spanButtonPlaceholder2"></span>
					<input id="btnCancel2" type="button" value="Anuluj" onclick="cancelQueue(upload1);" disabled="disabled" style="margin-left: 2px; height: 22px; font-size: 8pt;width:120px;" />
					<br />
				</div>
			</div>
		
		</td>
	</tr>
	<tr>
		<td class="lb">Symbol:</td>
		<td class="inpy"><input type="text" name="symbol" value="<?php echo $this->symbol ?>" /></td>
	</tr>
	<tr>
		<td class="lb">Kategorie:</td>
		<td class="inpy"><?php echo $this->Categories( $this->categoriesList, $this->categories ) ?></td>
	</tr>
	<tr>
		<td class="lb">Vat:</td>
		<td class="inpy">
			<select name="vat_v_id">
			<?php foreach( $this->vatList as $value ) { ?>
				<option <?php echo ( $this->vat_v_id == $value['v_id'] ) ? 'selected="selected"' : ''; ?> value="<?php echo $value->v_id ?>"><?php echo $value->rate ?> %</option>
			<?php } ?>
			</select>
		</td>
	</tr>
</table>
</form>
<?php if( $this->ps_id ) { ?>
	<div id="lettercontent">
	<?php echo $this->inlineScript()->setScript('
		$(document).ready(function(){
			$.post(
				baseUrl + "/cpproducts/getproducts/special/1",
				{
					id : ' . $this->ps_id . '
				},
				function( resp ) {
					$( "#lettercontent" ).append( resp );
					linkProduct( 1 );
				}
			);
		});
	') ?>
	</div>
<?php } ?>
<table>
	<tr>
		<td>
			<a class="button" href="<?php echo $this->baseUrl() ?>/cpproducts/listspecial">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/left_16.png);" class="inb">Wróć do listy</div>
			</a>
		</td>
		<td>
			<a class="button" href="javascript:void(null)" onclick="$('#formitem').submit()">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/save_16.png);" class="inb">Zapisz</div>
			</a>
		</td>
	</tr>
</table>